﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Warehouse.DataAccess
{
    public partial class DistributorPrice : CustomeEntity<DistributorPrice>
    {
        protected override System.Linq.Expressions.Expression<Func<DistributorPrice, bool>> GetPredicate()
        {
            return (p => p.DistributorID == this.DistributorID && p.ProductSpecificationID == this.ProductSpecificationID);
        }

        public static DistributorPrice GetOne(int distributorId, int productspecificationId)
        {
            using (WarehouseClassesDataContext ctx = new WarehouseClassesDataContext())
            {
                return (from t in ctx.DistributorPrice where t.DistributorID == distributorId && t.ProductSpecificationID == productspecificationId select t).SingleOrDefault();
            }
        }

        public static DistributorPrice[] Search(int distributorId)
        {
            using (WarehouseClassesDataContext ctx = new WarehouseClassesDataContext())
            {
                return (from t in ctx.DistributorPrice where t.DistributorID == distributorId select t).ToArray();
            }
        }
    }
}
